<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="keyword" content="">

    <title></title>

    <!-- Bootstrap core CSS -->
    <link href="assets/css/bootstrap.css" rel="stylesheet">
    <link href="assets/css/bootstrap.min.css.css" rel="stylesheet">
    <link href="assets/css/ace.min.css" rel="stylesheet">
    <!--external css-->
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="assets/js/gritter/css/jquery.gritter.css"/>

    <!-- Custom styles for this template -->
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/style-responsive.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="assets/js/jquery.js"></script>
    <script src="assets/js/jquery-1.8.3.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script class="include" type="text/javascript" src="assets/js/jquery.dcjqaccordion.2.7.js"></script>
    <script src="assets/js/jquery.scrollTo.min.js"></script>
    <script src="assets/js/jquery.nicescroll.js" type="text/javascript"></script>


    <!--common script for all pages-->
    <script src="assets/js/common-scripts.js"></script>

    <!--script for this page-->
    <script type="text/javascript" src="assets/js/gritter/js/jquery.gritter.js"></script>
    <script type="text/javascript" src="assets/js/gritter-conf.js"></script>
    <script type="text/javascript">
        $().ready(function () {
            loadHtml();
        });
        var showbakstart = "                    <div class=\"showback\" style='padding: 5px' >";
        var title = " <h4><i class=\"fa fa-angle-right\"></i> $title</h4>" ;
        var msg = " <b class=\"col-xs-6\">$msg</b>"
        var msg_head = "  <div class=\"widget-body\" style=\"font-size: x-small \" >\n" +
            "                            <div class=\"widget-main no-padding\">\n" +
            "                                <table class=\"table table-bordered table-striped\">\n" +
            "                                    <thead class=\"thin-border-bottom\">\n" +
            "                                    <tr>\n" +
            "                                        <th>\n" +
            "                                            <i class=\"ace-icon fa fa-caret-right blue\"></i>$name1\n" +
            "                                        </th>\n" +
            "                                        <th>\n" +
            "                                            <i class=\"ace-icon fa fa-caret-right blue\"></i>$name2\n" +
            "                                        </th>\n" +
            "                                    </tr>\n" +
            "                                    </thead>\n" +
            "                                    <tbody>\n" +
            "                                    <tr>";
        var msg_a ="                                 <tr>\n" +
            "                                        <td>$name</td>\n" +
            "                                        <td>\n" +
            "                                            <b class=\"green\">$price</b>\n" +
            "                                        </td>\n" +
            "                                    </tr>";
        var msg_b ="                                 <tr>\n" +
            "                                        <td>$name</td>\n" +
            "                                        <td>\n" +
            "                                            <b class=\"blue\">$price</b>\n" +
            "                                        </td>\n" +
            "                                    </tr>";
        var msg_end ="  </tbody>\n" +
            "                                </table>\n" +
            "                            </div><!-- /.widget-main -->";
        var pic = " <img src=\"$png\" style=\"width:100%;\"/>";
        var divend = "</div>";
        var html = "";

        function loadHtml() {
            var weiurl  = window.location.search;
            weiurl = weiurl.substring(1,weiurl.indexOf("&"));
            var chatJsonFile =  weiurl.substring(weiurl.lastIndexOf('=')+1, weiurl.length);
            $.ajax({
                url: "/weisend/queryWeiChatParam.action",
                type: "post",
                dataType: "json",
                data: {"chatJsonFile":chatJsonFile},
                success: function (data) {
//                    alert(data);
                    if (data) {
                        console.log(data)
                        // 删除成功将表格刷新
                        html = html.concat(showbakstart);
                        for (var i = 0; i < data.chat.length; i++) {
                            html = html.concat(title.replace('$title', data.chat[i].send_Title));

                            var cts = data.chat[i].msg;
//                            var cts = content.split(',');
                            for (var j = 0; j < cts.length; j++) {
                                if(j==0){
                                    html = html.concat(msg_head.replace('$name1',data.chat[i].msg_Title_Name).replace('$name2',data.chat[i].msg_Title_Value));
                                }
                                if ((j + 1) % 2 == 0) {
                                    html = html.concat(msg_a.replace('$name', cts[j].name).replace('$price',cts[j].price));
                                } else {
                                    html = html.concat(msg_b.replace('$name', cts[j].name).replace('$price',cts[j].price));
                                }
                                if(j+1==cts.length){
                                    html = html.concat(msg_end);
                                }
                            }

                            html = html.concat(pic.replace('$png', 'data:image/png;base64,' + data.chat[i].svg));
                            html = html.concat(divend);
                        }
                        html = html.concat(divend);
                        $("#contentview").html(html);

                    }
                }
            });
        }

    </script>
</head>

<body>

<section id="container">
    <section id="main-content" style="margin-left: auto">
        <section class="wrapper" style="margin-top: auto">
            <div class="row mt">
                <div id="contentview" class="col-xs-12" style="padding: 0px">
                    <!--这个是添加的内容-->
                </div><!-- /col-lg-6 -->

            </div><!--/ row -->
        </section>
        <! --/wrapper -->
    </section><!-- /MAIN CONTENT -->

    <!--main content end-->
    <!--footer start-->
    <footer class="site-footer">
        <div class="text-center">
            Copyright &copy; 2017.Company name All rights reserved.<a target="_blank"
                                                                      href=""></a>
            <a href="general.html#" class="go-top">
                <i class="fa fa-angle-up"></i>
            </a>
        </div>
    </footer>
    <!--footer end-->
</section>

</body>
</html>
